<?php
/* OpenManage
 * Plugin Launch Utilities
 * pluginLauncher.php
 * Released under the GNU General Public Licnese version 3
 */

/* @depreceated
 * @author Ciaran Crocker <ciaran.crocker5@gmail.com>
 */
function runCommand($command) {
	$e = $command();
	if(!$e) {
		throw new Exception('3-COMMANDNOTFOUND');
	}else{
		$command();
		return true;
	}
};

/* @depreceated
 * @author Ciaran Crocker <ciaran.crocker5@gmail.com>
 */
function loadPlugin($plugin) {
	$plug = file_exists('/plugins/' . $plugin . '/load.php');
	if(!$plug) {
		throw new Exception('2-PLUGINNOTFOUND');
	}else{
		include('/plugins/' . $plugin . '/load.php');
		return true;
	}
};


/* @since r19
 * @author Ciaran Crocker <ciaran.crocker5@gmail.com>
 * @returns boolean
 */
function checkCommandExists($command) {
	foreach($commands as $trythis) {
		if($trythis = $command) {
			return true;
		};
	};
	return false:
};

/* @since r19
 * @author Ciaran Crocker <ciaran.crocker5@gmail.com>
 * @returns boolean
 */
function checkPluginExists($plugin) {
	$trythis = file_exists('/plugins/' . $plugin . '/load.php');
	if($trythis) {
		return true;
	} else {
		return false;
	};
};